<template>
	<view>
		<view class="courses" v-for="(item,index) in RecommendedCoursesData" :key="index"  @click="toCourseInformation(item.id)">
			<image style="border-radius: 20rpx;" src="../../static/img/1.png"  mode="aspectFill"></image>
			<view class="content">
				<!-- <view style="font-size: 25rpx;">2022年秋学期</view> -->
				<view style="font-size: 35rpx;font-weight: bold;">{{item.name}}</view>
				<view style="font-size: 28rpx;margin: 10rpx 0;padding-left: 10rpx;background-color: #4169E1;margin-right: 165rpx;border-radius: 10rpx;color: #FFFFFF;">授课教师：{{item.schoolTeacher.name}}</view>
				<view style="display: flex;font-size: 20rpx;color: #696969;">
					<view>
						<view v-show="item.schoolDepartment != ''">{{item.schoolDepartment.name}}</view>
						<!-- <view style="margin-top: 10rpx;">评论数量：100</view> -->
					</view>
					<view style="margin-left: 35rpx;">
						<view v-if="item.schoolMajor != null">{{item.schoolMajor.name}}</view>
						<!-- <view style="margin-top: 10rpx;">学习时长：{{item.id}}min</view> -->
					</view>
				</view>
				<!-- <text class="text1">{{item.name}}</text>
				</br>
				<view class="minContent">
					<view class="hook">
						<image src="../../static/img/hook.png"></image>
						<text>适龄:所有人</text>
					</view>
					
					<view class="play">
						<image src="../../static/img/play.png"></image>
						<text>{{item.id}}次</text>
					</view>
				</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"RecommendedCourses",
		data() {
			return {
				RecommendedCoursesData:[]
			};
		},
		methods: {
			async recommendedCourses() {
				let that = this;
				const res = await that.$myRequest({
					url:'/api/mobile/schoolcourse/query',
					data:{
						recommend: true,
						pageSize: 5,
					},
				})
				console.log(res);
				if(res.success){
					that.RecommendedCoursesData = res.data.data
				}
			},
			toCourseInformation(id) {
				console.log(id)
				uni.navigateTo({
					url: '../courseInformation/courseInformation?id='+id
				})
			},
		},
		created() {
			this.recommendedCourses();
		}
	}
</script>

<style  lang="scss" scoped>
	*{
		margin: 0rpx;
	}
	.courses{
		width: 100%;
		height: 250rpx;
		background-color: #fff;
		border-radius: 20rpx;
		display: flex;
		margin-bottom: 20rpx;
		
		image{
			flex: 2;
			height: 82%;
			width: 100rpx;
			margin: 20rpx;
		}
		
		.content{
			flex: 4;
			margin: 25rpx;
			// margin-top: 30rpx;
			
			.text1{
				margin-bottom: 40rpx;
			}
			
			.text2{
				font-size: 22rpx;
				color: #666666;
				margin-top: 40rpx;
			}
			
			.minContent{
				display: flex;
				.hook{
					flex: 3;
					height: 50rpx;
					margin-top: 80rpx;
					
					image{
						margin: 0%;
						float: left;
					}
					text{
						font-size: 22rpx;
						color: #999999;
						margin-left: 5rpx;
						line-height: 50rpx;
					}
				}
				
				.play{
					flex: 2;
					height: 50rpx;
					margin-top: 80rpx;
					margin-right: 20rpx;
					
					image{
						margin: 5rpx;
						float: left;
						width: 42rpx;
						height: 42rpx;
					}
					text{
						font-size: 22rpx;
						float: left;
						color: #999999;
						line-height: 50rpx;
						margin-left: 5rpx;
					}
				}
			}
			
			image{
				width: 46rpx;
				height: 46rpx;
			}
		}
	}
</style>